//
//  UIView+XMGExtension.m
//  3期-百思不得姐
//
//  Created by xiaomage on 15/9/2.
//  Copyright (c) 2015年 xiaomage. All rights reserved.
//

#import "UIView+mmjExtension.h"

@implementation UIView (mmjExtension)

- (CGSize)mmj_size
{
    return self.frame.size;
}

- (void)setMmj_size:(CGSize)mmj_size
{
    CGRect frame = self.frame;
    frame.size = mmj_size;
    self.frame = frame;
}

- (CGFloat)mmj_width
{
    return self.frame.size.width;
}

- (CGFloat)mmj_height
{
    return self.frame.size.height;
}

- (void)setMmj_width:(CGFloat)mmj_width
{
    CGRect frame = self.frame;
    frame.size.width = mmj_width;
    self.frame = frame;
}

- (void)setMmj_height:(CGFloat)mmj_height
{
    CGRect frame = self.frame;
    frame.size.height = mmj_height;
    self.frame = frame;
}

- (CGFloat)mmj_x
{
    return self.frame.origin.x;
}

- (void)setMmj_x:(CGFloat)mmj_x
{
    CGRect frame = self.frame;
    frame.origin.x = mmj_x;
    self.frame = frame;
}

- (CGFloat)mmj_y
{
    return self.frame.origin.y;
}

- (void)setMmj_y:(CGFloat)mmj_y
{
    CGRect frame = self.frame;
    frame.origin.y = mmj_y;
    self.frame = frame;
}

- (CGFloat)mmj_centerX
{
    return self.center.x;
}

- (void)setMmj_centerX:(CGFloat)mmj_centerX
{
    CGPoint center = self.center;
    center.x = mmj_centerX;
    self.center = center;
}

- (CGFloat)mmj_centerY
{
    return self.center.y;
}

- (void)setMmj_centerY:(CGFloat)mmj_centerY
{
    CGPoint center = self.center;
    center.y = mmj_centerY;
    self.center = center;
}

- (CGFloat)mmj_right
{
    //    return self.mmj_x + self.mmj_width;
    return CGRectGetMaxX(self.frame);
}

- (CGFloat)mmj_bottom
{
    //    return self.mmj_y + self.mmj_height;
    return CGRectGetMaxY(self.frame);
}

- (void)setMmj_right:(CGFloat)mmj_right
{
    self.mmj_x = mmj_right - self.mmj_width;
}

- (void)setMmj_bottom:(CGFloat)mmj_bottom
{
    self.mmj_y = mmj_bottom - self.mmj_height;
}
@end
